Add support for mkinitcpio
authorDaniel Narvaez <dwnarvaez@gmail.com>
Tue, 22 Oct 2013 20:04:32 +0000 (22:04 +0200)
committerColin Walters <walters@verbum.org>
Thu, 24 Oct 2013 18:27:49 +0000 (14:27 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=710682

15 files changed:
Makefile-boot.am [new file with mode: 0644]
Makefile-dracut.am [deleted file]
Makefile-switchroot.am
Makefile.am
configure.ac
src/boot/dracut/module-setup.sh [new file with mode: 0755]
src/boot/dracut/ostree.conf [new file with mode: 0755]
src/boot/mkinitcpio/ostree [new file with mode: 0644]
src/boot/mkinitcpio/ostree-mkinitcpio.conf [new file with mode: 0644]
src/boot/ostree-prepare-root.service [new file with mode: 0644]
src/boot/ostree-remount.service [new file with mode: 0644]
src/dracut/module-setup.sh [deleted file]
src/dracut/ostree-prepare-root.service [deleted file]
src/dracut/ostree-remount.service [deleted file]
src/dracut/ostree.conf [deleted file]

diff --git a/Makefile-boot.am b/Makefile-boot.am
new file mode 100644 (file)
index 0000000..49b3c03
--- /dev/null
@@ -0,0 +1,48 @@
+# Makefile for dracut module
+#
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+if BUILDOPT_DRACUT
+# Not using $(libdir) here is intentional, dracut modules go in prefix/lib
+dracutmoddir = $(prefix)/lib/dracut/modules.d/98ostree
+dracutmod_SCRIPTS = src/boot/dracut/module-setup.sh
+
+dracutconfdir = $(sysconfdir)/dracut.conf.d
+dracutconf_DATA = src/boot/dracut/ostree.conf
+endif
+
+if BUILDOPT_MKINITCPIO
+mkinitcpioinstalldir = $(prefix)/lib/initcpio/install
+mkinitcpioinstall_SCRIPTS = src/boot/mkinitcpio/ostree
+
+mkinitcpioconfdir = $(sysconfdir)
+mkinitcpioconf_DATA = src/boot/mkinitcpio/ostree-mkinitcpio.conf
+endif
+
+if BUILDOPT_SYSTEMD
+systemdsystemunit_DATA = src/boot/ostree-prepare-root.service \
+       src/boot/ostree-remount.service
+endif
+
+EXTRA_DIST += src/boot/dracut/module-setup.sh \
+       src/boot/dracut/ostree.conf \
+       src/boot/mkinitcpio/ostree \
+       src/boot/ostree-prepare-root.service \
+       src/boot/ostree-remount.service \
+       $(NULL)
+
diff --git a/Makefile-dracut.am b/Makefile-dracut.am
deleted file mode 100644 (file)
index d9e0dd4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-# Makefile for dracut module
-#
-# Copyright (C) 2013 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-if BUILDOPT_DRACUT
-# Not using $(libdir) here is intentional, dracut modules go in prefix/lib
-dracutmoddir = $(prefix)/lib/dracut/modules.d/98ostree
-dracutmod_SCRIPTS = src/dracut/module-setup.sh
-dracutmod_DATA = src/dracut/ostree-prepare-root.service
-
-systemdsystemunit_DATA = src/dracut/ostree-remount.service
-
-dracutconfdir = $(sysconfdir)/dracut.conf.d
-dracutconf_DATA = src/dracut/ostree.conf
-endif
-
-EXTRA_DIST += src/dracut/module-setup.sh \
-       src/dracut/ostree-prepare-root.service \
-       src/dracut/ostree-remount.service \
-       src/dracut/ostree.conf \
-       $(NULL)
-
index 3dacb87a505fc411b62dd9d7d11fbb47761968a1..ef837ced2bed02f2e8e8d62a595015cbffb01051 100644 (file)
@@ -15,7 +15,7 @@
 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-if BUILDOPT_DRACUT
+if BUILDOPT_SYSTEMD
 sbin_PROGRAMS += ostree-prepare-root
 sbin_PROGRAMS += ostree-remount
 noinst_LTLIBRARIES += libswitchroot-mountutil.la
index 578f26508d6dd6922c364045f0ee8881aa612dff..131a45835aff820defb7d980d96db0b4d33b51ef 100644 (file)
@@ -108,7 +108,7 @@ include Makefile-libostree.am
 include Makefile-ostree.am
 include Makefile-switchroot.am
 include Makefile-tests.am
-include Makefile-dracut.am
+include Makefile-boot.am
 
 install-data-hook: $(INSTALL_DATA_HOOKS)
 
index 7cfa64b9bddfb3332ac1e7f9cac9db62d630eb5a..073b7a36a00be3cff7cfaf9622a5a932680c0c83 100644 (file)
@@ -143,7 +143,14 @@ AC_ARG_WITH(dracut,
               [with_dracut=no])
 AM_CONDITIONAL(BUILDOPT_DRACUT, test x$with_dracut = xyes)
 
-AS_IF([test "x$with_dracut" = "xyes"], [
+AC_ARG_WITH(mkinitcpio,
+            AS_HELP_STRING([--with-mkinitcpio],
+                           [Install mkinitcpio module (default: no)]),,
+              [with_mkinitcpio=no])
+AM_CONDITIONAL(BUILDOPT_MKINITCPIO, test x$with_mkinitcpio = xyes)
+
+AS_IF([test "x$with_dracut" = "xyes" || test "x$with_mkinitcpio" = "xyes"], [
+  with_systemd=yes
   AC_ARG_WITH([systemdsystemunitdir],
               AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
               [],
@@ -152,6 +159,7 @@ AS_IF([test "x$with_dracut" = "xyes"], [
     AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
   ])
 ])
+AM_CONDITIONAL(BUILDOPT_SYSTEMD, test x$with_systemd = xyes)
 
 dnl for tests
 AS_IF([test "x$found_introspection" = xyes], [
@@ -184,8 +192,9 @@ echo "
     gpgme (sign commits):                         $with_gpgme
     documentation:                                $enable_gtk_doc
     gjs-based tests:                              $have_gjs
-    dracut:                                       $with_dracut"
-AS_IF([test "x$with_dracut" = "xyes"], [
+    dracut:                                       $with_dracut
+    mkinitcpio:                                   $with_mkinitcpio"
+AS_IF([test "x$with_systemd" = "xyes"], [
     echo "    systemd unit dir:                             $with_systemdsystemunitdir"
 ])
 echo ""
diff --git a/src/boot/dracut/module-setup.sh b/src/boot/dracut/module-setup.sh
new file mode 100755 (executable)
index 0000000..a976991
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+#
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+check() {
+    if [[ -x $systemdutildir/systemd ]] && [[ -x /usr/sbin/ostree-prepare-root ]]; then
+       return 255
+    fi
+
+    return 1
+}
+
+depends() {
+    return 0
+}
+
+install() {
+    dracut_install ostree-prepare-root
+    inst_simple "${systemdsystemunitdir}/ostree-prepare-root.service"
+    mkdir -p "${initdir}${systemdsystemconfdir}/initrd-switch-root.target.wants"
+    ln_r "${systemdsystemunitdir}/ostree-prepare-root.service" \
+        "${systemdsystemconfdir}/initrd-switch-root.target.wants/ostree-prepare-root.service"
+}
+
diff --git a/src/boot/dracut/ostree.conf b/src/boot/dracut/ostree.conf
new file mode 100755 (executable)
index 0000000..612bb43
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+add_dracutmodules+=" ostree systemd "
diff --git a/src/boot/mkinitcpio/ostree b/src/boot/mkinitcpio/ostree
new file mode 100644 (file)
index 0000000..4674837
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+build() {
+    add_binary /usr/sbin/ostree-prepare-root
+    add_binary /usr/sbin/ostree-remount
+
+    add_file /usr/lib/systemd/system/ostree-prepare-root.service
+    add_symlink /usr/lib/systemd/system/initrd-switch-root.target.wants/ostree-prepare-root.service \
+        /usr/lib/systemd/system/ostree-prepare-root.service
+}
diff --git a/src/boot/mkinitcpio/ostree-mkinitcpio.conf b/src/boot/mkinitcpio/ostree-mkinitcpio.conf
new file mode 100644 (file)
index 0000000..75d26eb
--- /dev/null
@@ -0,0 +1 @@
+HOOKS="base systemd ostree autodetect modconf block filesystems keyboard fsck"
diff --git a/src/boot/ostree-prepare-root.service b/src/boot/ostree-prepare-root.service
new file mode 100644 (file)
index 0000000..230c856
--- /dev/null
@@ -0,0 +1,32 @@
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+[Unit]
+Description=OSTree Prepare OS/
+DefaultDependencies=no
+ConditionKernelCommandLine=ostree
+ConditionPathExists=/etc/initrd-release
+OnFailure=emergency.service
+After=initrd-switch-root.target
+Before=initrd-switch-root.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/ostree-prepare-root /sysroot
+StandardInput=null
+StandardOutput=syslog
+StandardError=syslog+console
diff --git a/src/boot/ostree-remount.service b/src/boot/ostree-remount.service
new file mode 100644 (file)
index 0000000..26b7d39
--- /dev/null
@@ -0,0 +1,36 @@
+# Copyright (C) 2013 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+[Unit]
+Description=OSTree Remount OS/ bind mounts
+DefaultDependencies=no
+ConditionKernelCommandLine=ostree
+OnFailure=emergency.service
+Conflicts=umount.target
+After=-.mount
+After=systemd-remount-fs.service
+Before=local-fs.target umount.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/ostree-remount
+StandardInput=null
+StandardOutput=syslog
+StandardError=syslog+console
+
+[Install]
+WantedBy=local-fs.target
diff --git a/src/dracut/module-setup.sh b/src/dracut/module-setup.sh
deleted file mode 100755 (executable)
index b2af772..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-#
-# Copyright (C) 2013 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-check() {
-    if [[ -x $systemdutildir/systemd ]] && [[ -x /usr/sbin/ostree-prepare-root ]]; then
-       return 255
-    fi
-
-    return 1
-}
-
-depends() {
-    return 0
-}
-
-install() {
-    dracut_install ostree-prepare-root
-    inst_simple "$moddir/ostree-prepare-root.service" "${systemdsystemunitdir}/ostree-prepare-root.service"
-    mkdir -p "${initdir}${systemdsystemconfdir}/initrd-switch-root.target.wants"
-    ln_r "${systemdsystemunitdir}/ostree-prepare-root.service" \
-        "${systemdsystemconfdir}/initrd-switch-root.target.wants/ostree-prepare-root.service"
-}
-
diff --git a/src/dracut/ostree-prepare-root.service b/src/dracut/ostree-prepare-root.service
deleted file mode 100644 (file)
index 230c856..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2013 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-[Unit]
-Description=OSTree Prepare OS/
-DefaultDependencies=no
-ConditionKernelCommandLine=ostree
-ConditionPathExists=/etc/initrd-release
-OnFailure=emergency.service
-After=initrd-switch-root.target
-Before=initrd-switch-root.service
-
-[Service]
-Type=oneshot
-ExecStart=/usr/sbin/ostree-prepare-root /sysroot
-StandardInput=null
-StandardOutput=syslog
-StandardError=syslog+console
diff --git a/src/dracut/ostree-remount.service b/src/dracut/ostree-remount.service
deleted file mode 100644 (file)
index 26b7d39..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2013 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-[Unit]
-Description=OSTree Remount OS/ bind mounts
-DefaultDependencies=no
-ConditionKernelCommandLine=ostree
-OnFailure=emergency.service
-Conflicts=umount.target
-After=-.mount
-After=systemd-remount-fs.service
-Before=local-fs.target umount.target
-
-[Service]
-Type=oneshot
-ExecStart=/usr/sbin/ostree-remount
-StandardInput=null
-StandardOutput=syslog
-StandardError=syslog+console
-
-[Install]
-WantedBy=local-fs.target
diff --git a/src/dracut/ostree.conf b/src/dracut/ostree.conf
deleted file mode 100755 (executable)
index 612bb43..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2013 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-add_dracutmodules+=" ostree systemd "